Skip to content

Automated Test: localization-system-post #315

Closed

Conversation

admin-coderabbit
Copy link
Owner

@admin-coderabbit admin-coderabbit commented Feb 4, 2026

This pull request was automatically created by @coderabbitai/e2e-reviewer.

Batch created pull request.

Summary by CodeRabbit

  • Refactor

    • Updated locale fallback mechanism with custom fallback hierarchy.
    • Removed I18n pluralization backend support.
    • Enhanced locale preloading to ensure translations are properly initialized.
  • Chores

    • Adjusted internationalization configuration across production and profile environments.

The FallbackLocaleList object tells I18n::Backend::Fallbacks what order the
languages should be attempted in. Because of the translate_accelerator patch,
the SiteSetting.default_locale is *not* guaranteed to be fully loaded after the
server starts, so a call to ensure_loaded! is added after the locale is set for
the current user.

The declarations of config.i18n.fallbacks = true in the environment files were
actually garbage, because the I18n.default_locale was
SiteSetting.default_locale, so there was nothing to fall back to. *derp*
@coderabbit-eval
Copy link

coderabbit-eval bot commented Feb 4, 2026

📝 Walkthrough

Walkthrough

This PR refactors the i18n fallback system by replacing Rails' built-in config.i18n.fallbacks configuration with a custom FallbackLocaleList class. Environment-level fallback configurations are removed and consolidated into a custom initializer that provides locale-specific fallback chains. Pluralization backend support is also removed, and locale preloading is explicitly triggered during locale setup.

Changes

Cohort / File(s) Summary
Configuration Removal
config/cloud/cloud66/files/production.rb, config/environments/production.rb, config/environments/profile.rb
Removed config.i18n.fallbacks = true setting from environment configurations, eliminating the Rails default fallback mechanism.
Custom Fallback System
config/initializers/i18n.rb
Introduced FallbackLocaleList class that subclasses Hash to provide custom locale fallback chains, defaulting to [user_locale, site_default_locale, :en] with deduplication, and added ensure_loaded! method for eager locale loading.
Pluralization Backend Removal
config/initializers/pluralization.rb
Removed the i18n pluralization backend initialization, eliminating support for automatic pluralization in translations.
Locale Preloading Integration
app/controllers/application_controller.rb, lib/freedom_patches/translate_accelerator.rb
Added ensure_loaded!(locale) method to I18n singleton class and integrated it into the set_locale method to preload locale fallbacks on demand.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 Whiskers twitch with translation glee,
Custom fallbacks now run free,
From Rails' defaults we've broken free,
Locales load with ensure_loaded! spree,
A new i18n dance, you'll surely see!

🚥 Pre-merge checks | ✅ 1 | ❌ 1
❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Title check ❓ Inconclusive The title 'Automated Test: localization-system-post' is vague and does not meaningfully describe the actual changes in the changeset, which involve significant refactoring of I18n fallback and pluralization configuration. Replace the generic test label with a descriptive title that reflects the main change, such as 'Refactor I18n fallback configuration to use custom FallbackLocaleList' or similar.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch localization-system-post

Comment @coderabbit eval help to get the list of available commands and usage tips.

@coderabbit-eval coderabbit-eval bot closed this Feb 4, 2026
Sign in to join this conversation on GitHub.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant